package com.duzq.controller;

import com.duzq.entity.User;
import com.duzq.entity.UserExt;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 用户
 * @author duzq
 * @date 2021-03-24 14:51:45
 */
@RestController
public class UserController {

    /**
     * 查询用户
     * @return
     */
    @RequestMapping("/getUser")
    public User getUser() {
        User user = new User();
        user.setId(1);
        user.setName("duzq");
        user.setStatus(10);
        return user;
    }

    /**
     * 查询用户
     * @return
     */
    @RequestMapping("/getUserExt")
    public UserExt getUserExt() {
        UserExt user = new UserExt();
        user.setId(1);
        user.setName("duzq");
        user.setStatus(10);
        user.setStatusExt(10);
        return user;
    }

    /**
     * 查询用户
     * @return
     */
    @RequestMapping("/getUserList")
    public List getUserList() {

        UserExt userExt = new UserExt();
        userExt.setId(1);
        userExt.setName("duzq");
        userExt.setStatus(10);
        userExt.setStatusExt(10);

        User user = new User();
        user.setId(1);
        user.setName("duzq");
        user.setStatus(10);

        List list = new ArrayList();
        list.add(userExt);
        list.add(user);
        return list;
    }

    /**
     * 查询用户
     * @return
     */
    @RequestMapping("/getUserMap")
    public Map getUserMap() {
        UserExt userExt = new UserExt();
        userExt.setId(1);
        userExt.setName("duzq");
        userExt.setStatus(10);
        userExt.setStatusExt(10);

        User user = new User();
        user.setId(1);
        user.setName("duzq");
        user.setStatus(10);

        Map<String, Object> resMap = new HashMap<>();
        resMap.put("UserExt", userExt);
        resMap.put("userExt", user);
        return resMap;
    }
}
